//
//  TableViewCell.m
//  项目一TimeMovie
//
//  Created by apple on 16/3/30.
//  Copyright © 2016年 huangmingyu. All rights reserved.
//

#import "TableViewCell.h"
#import "HomeModel.h"

@implementation TableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


- (void)setCellModel:(HomeModel *)cellmodel {
    
    _cellModel = cellmodel;
    
    self.tiltelLabel.text = _cellModel.tiltle;
    
    self.yearLabel.text = [NSString stringWithFormat:@"年份：%@",_cellModel.year];
    self.ratingLabel.text = [NSString stringWithFormat:@"%.1f", [_cellModel.rating[@"average"] floatValue]];
    
//    self.imageView.image = [UIImage imageNamed:@"pig"];
    self.tiltelLabel.textColor = [UIColor colorWithRed:122.0/255 green:59.0/255 blue:19.0/255 alpha:1];
    NSString *imageURL = _cellModel.images[@"medium"];
    [self.tiltleImage sd_setImageWithURL:[NSURL URLWithString:imageURL] placeholderImage:[UIImage imageNamed:@"pig"]];
    
    [_ratingView changeStarViewWithRating:[_ratingLabel.text floatValue]];
    
    
//    if ([NSData dataWithContentsOfURL:[NSURL URLWithString:imageURL]]) {
//        
//        self.imageView.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:imageURL]]];
//    }
    
    
}


@end
